FROM andcircle/tensorrt_plugin_dev:v5.0

WORKDIR /home/install/

RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 'A4B469963BF863CC'
RUN apt-get update -y



RUN  apt-get update
RUN  apt-get -y upgrade
RUN  apt-get -y install  ssh
RUN  apt-get -y install  vim
RUN  apt-get -y install  build-essential
RUN  apt-get -y install  cmake
RUN  apt-get -y install  git
RUN  apt-get -y install  libgtk2.0-dev
RUN  apt-get -y install  pkg-config
RUN  apt-get -y install  libavcodec-dev
RUN  apt-get -y install  libavformat-dev
RUN  apt-get -y install  libswscale-dev
RUN  apt-get -y install  python-dev
RUN  apt-get -y install  python-numpy
RUN  apt-get -y install  libtbb2
RUN  apt-get -y install  libtbb-dev
RUN  apt-get -y install  libjpeg-dev
RUN  apt-get -y install  libpng-dev
RUN  apt-get -y install  libtiff-dev
RUN  apt-get -y install  libdc1394-22-dev
RUN  apt-get -y install  qtbase5-dev
RUN  apt-get -y install  qtdeclarative5-dev
RUN  apt-get -y install  python3-pip
RUN  apt-get -y install  zip
RUN  apt-get install software-properties-common -y
RUN  add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
RUN  apt-get -y install  libjasper-dev

ADD opencv-4.3.0.zip opencv-4.3.0.zip
ADD opencv_contrib-4.3.0.zip opencv_contrib-4.3.0.zip

# opencv 安装
RUN bash -xc "unzip opencv-4.3.0.zip && mv opencv-4.3.0 opencv && \
    unzip opencv_contrib-4.3.0.zip && mv opencv_contrib-4.3.0 opencv_contrib && \
    pushd opencv>&1 > /dev/null && mkdir build && pushd build>&1 > /dev/null && \
    cmake -D WITH_QT=ON \
          -D WITH_CUDA=ON \
          -D BUILD_TIFF=ON \
          -D BUILD_TESTS=OFF \
          -D BUILD_PERF_TESTS=OFF \
          -D OPENCV_GENERATE_PKGCONFIG=ON \
          -D CMAKE_INSTALL_PREFIX=/usr/local \
          -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ \
          -D BUILD_opencv_xfeatures2d=OFF  .. && \
    make -j4 && make -j4 install && pkg-config --cflags opencv4 && echo '/usr/local/lib' > /etc/ld.so.conf.d/opencv.conf && \
    popd 2>&1 > /dev/null && popd 2>&1 > /dev/null && rm -rf opencv-4.3.0.zip && rm -rf opencv_contrib-4.3.0.zip"



#sudo docker build -t='bewithmeallmylife/tensorrt-inference-runtime:cuda10.2-cudnn8-trt7-devel-ubuntu18.04' .